package com.service;

import com.dao.userdao.Search;
import com.pojo.Article;
import com.pojo.Column;
import com.pojo.SearchUser;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;

/*处理搜索界面的请求*/
public class SearchService {
    /**
     *搜索用户
     */
    public static List<SearchUser> search_user(String search_content,String userid,int page_number) throws IOException {
            return Search.search_user(page_number*10,userid,"%"+search_content+"%");
    }
    /**
     * 搜素博客
     */
    public static List<Article> search_blog(HttpServletRequest req)throws IOException{
        int page_number= Integer.parseInt(req.getParameter("page"));
        return Search.search_blog(page_number*7,"%"+req.getParameter("search_content")+"%");
    }

    /**
     * 搜索专栏
     */
    public static List<Column> search_column(HttpServletRequest req)throws IOException{
         int page_number=Integer.parseInt(req.getParameter("page"));
         return Search.search_column(page_number*10,"%"+req.getParameter("search_content")+"%");
    }
}
